﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Project.dalSql;
using WISD.Common;
using WISD.DBUtility.DBOperate;

namespace WISD.CarFriend.BLL.OA
{
    public class MemberModule
    {
        #region MaticCode
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string MemberID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from T_CF_OA_Member");
            strSql.Append(" where MemberID=@MemberID ");
            SqlParameter[] parameters = {
					new SqlParameter("@MemberID", SqlDbType.NVarChar,50)			};
            parameters[0].Value = MemberID;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(WISD.CarFriend.Model.CFModel.T_CF_OA_Member model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into T_CF_OA_Member(");
            strSql.Append("MemberID,WebUserName,WebPwd,Name,Sex,Birthday,MobileTel,QQ,Email,IdentityCard,Address,ReturnVisitDate,VehicleNo,VehicleStyle,EngineNo,VehicleFrameNo,DriveCardNo,DriveCardAnnualReviewDate,DriveCardGetDate,RideCardNo,RideCardAnnualReviewDate,PurchaseDate,NextMaintenanceDate,VehicleAnnualInspectionDate,InsuranceNo,InsuranceExpirationDate,OilConsumption,DriveKilometers,IsCard,State,Riviser,ReviseDate,Memo1,Memo2,Memo3,Memo4,Memo5,Memo6,Memo7,Memo8)");
            strSql.Append(" values (");
            strSql.Append("@MemberID,@WebUserName,@WebPwd,@Name,@Sex,@Birthday,@MobileTel,@QQ,@Email,@IdentityCard,@Address,@ReturnVisitDate,@VehicleNo,@VehicleStyle,@EngineNo,@VehicleFrameNo,@DriveCardNo,@DriveCardAnnualReviewDate,@DriveCardGetDate,@RideCardNo,@RideCardAnnualReviewDate,@PurchaseDate,@NextMaintenanceDate,@VehicleAnnualInspectionDate,@InsuranceNo,@InsuranceExpirationDate,@OilConsumption,@DriveKilometers,@IsCard,@State,@Riviser,@ReviseDate,@Memo1,@Memo2,@Memo3,@Memo4,@Memo5,@Memo6,@Memo7,@Memo8)");
            SqlParameter[] parameters = {
					new SqlParameter("@MemberID", SqlDbType.NVarChar,50),
					new SqlParameter("@WebUserName", SqlDbType.NVarChar,50),
					new SqlParameter("@WebPwd", SqlDbType.NVarChar,50),
					new SqlParameter("@Name", SqlDbType.NVarChar,50),
					new SqlParameter("@Sex", SqlDbType.Int,4),
					new SqlParameter("@Birthday", SqlDbType.DateTime),
					new SqlParameter("@MobileTel", SqlDbType.NVarChar,50),
					new SqlParameter("@QQ", SqlDbType.NVarChar,50),
					new SqlParameter("@Email", SqlDbType.NVarChar,50),
					new SqlParameter("@IdentityCard", SqlDbType.NVarChar,50),
					new SqlParameter("@Address", SqlDbType.NVarChar,100),
					new SqlParameter("@ReturnVisitDate", SqlDbType.DateTime),
					new SqlParameter("@VehicleNo", SqlDbType.NVarChar,50),
					new SqlParameter("@VehicleStyle", SqlDbType.NVarChar,50),
					new SqlParameter("@EngineNo", SqlDbType.NVarChar,50),
					new SqlParameter("@VehicleFrameNo", SqlDbType.NVarChar,50),
					new SqlParameter("@DriveCardNo", SqlDbType.NVarChar,50),
					new SqlParameter("@DriveCardAnnualReviewDate", SqlDbType.DateTime),
					new SqlParameter("@DriveCardGetDate", SqlDbType.DateTime),
					new SqlParameter("@RideCardNo", SqlDbType.NVarChar,50),
					new SqlParameter("@RideCardAnnualReviewDate", SqlDbType.DateTime),
					new SqlParameter("@PurchaseDate", SqlDbType.DateTime),
					new SqlParameter("@NextMaintenanceDate", SqlDbType.DateTime),
					new SqlParameter("@VehicleAnnualInspectionDate", SqlDbType.DateTime),
					new SqlParameter("@InsuranceNo", SqlDbType.NVarChar,50),
					new SqlParameter("@InsuranceExpirationDate", SqlDbType.DateTime),
					new SqlParameter("@OilConsumption", SqlDbType.NVarChar,500),
					new SqlParameter("@DriveKilometers", SqlDbType.NVarChar,50),
					new SqlParameter("@IsCard", SqlDbType.Int,4),
					new SqlParameter("@State", SqlDbType.Int,4),
					new SqlParameter("@Riviser", SqlDbType.NVarChar,50),
					new SqlParameter("@ReviseDate", SqlDbType.DateTime),
					new SqlParameter("@Memo1", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo2", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo3", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo4", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo5", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo6", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo7", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo8", SqlDbType.NVarChar,100)};
            parameters[0].Value = model.MemberID;
            parameters[1].Value = model.WebUserName;
            parameters[2].Value = model.WebPwd;
            parameters[3].Value = model.Name;
            parameters[4].Value = model.Sex;
            parameters[5].Value = model.Birthday;
            parameters[6].Value = model.MobileTel;
            parameters[7].Value = model.QQ;
            parameters[8].Value = model.Email;
            parameters[9].Value = model.IdentityCard;
            parameters[10].Value = model.Address;
            parameters[11].Value = model.ReturnVisitDate;
            parameters[12].Value = model.VehicleNo;
            parameters[13].Value = model.VehicleStyle;
            parameters[14].Value = model.EngineNo;
            parameters[15].Value = model.VehicleFrameNo;
            parameters[16].Value = model.DriveCardNo;
            parameters[17].Value = model.DriveCardAnnualReviewDate;
            parameters[18].Value = model.DriveCardGetDate;
            parameters[19].Value = model.RideCardNo;
            parameters[20].Value = model.RideCardAnnualReviewDate;
            parameters[21].Value = model.PurchaseDate;
            parameters[22].Value = model.NextMaintenanceDate;
            parameters[23].Value = model.VehicleAnnualInspectionDate;
            parameters[24].Value = model.InsuranceNo;
            parameters[25].Value = model.InsuranceExpirationDate;
            parameters[26].Value = model.OilConsumption;
            parameters[27].Value = model.DriveKilometers;
            parameters[28].Value = model.IsCard;
            parameters[29].Value = model.State;
            parameters[30].Value = model.Riviser;
            parameters[31].Value = model.ReviseDate;
            parameters[32].Value = model.Memo1;
            parameters[33].Value = model.Memo2;
            parameters[34].Value = model.Memo3;
            parameters[35].Value = model.Memo4;
            parameters[36].Value = model.Memo5;
            parameters[37].Value = model.Memo6;
            parameters[38].Value = model.Memo7;
            parameters[39].Value = model.Memo8;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WISD.CarFriend.Model.CFModel.T_CF_OA_Member model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update T_CF_OA_Member set ");
            strSql.Append("WebUserName=@WebUserName,");
            strSql.Append("WebPwd=@WebPwd,");
            strSql.Append("Name=@Name,");
            strSql.Append("Sex=@Sex,");
            strSql.Append("Birthday=@Birthday,");
            strSql.Append("MobileTel=@MobileTel,");
            strSql.Append("QQ=@QQ,");
            strSql.Append("Email=@Email,");
            strSql.Append("IdentityCard=@IdentityCard,");
            strSql.Append("Address=@Address,");
            strSql.Append("ReturnVisitDate=@ReturnVisitDate,");
            strSql.Append("VehicleNo=@VehicleNo,");
            strSql.Append("VehicleStyle=@VehicleStyle,");
            strSql.Append("EngineNo=@EngineNo,");
            strSql.Append("VehicleFrameNo=@VehicleFrameNo,");
            strSql.Append("DriveCardNo=@DriveCardNo,");
            strSql.Append("DriveCardAnnualReviewDate=@DriveCardAnnualReviewDate,");
            strSql.Append("DriveCardGetDate=@DriveCardGetDate,");
            strSql.Append("RideCardNo=@RideCardNo,");
            strSql.Append("RideCardAnnualReviewDate=@RideCardAnnualReviewDate,");
            strSql.Append("PurchaseDate=@PurchaseDate,");
            strSql.Append("NextMaintenanceDate=@NextMaintenanceDate,");
            strSql.Append("VehicleAnnualInspectionDate=@VehicleAnnualInspectionDate,");
            strSql.Append("InsuranceNo=@InsuranceNo,");
            strSql.Append("InsuranceExpirationDate=@InsuranceExpirationDate,");
            strSql.Append("OilConsumption=@OilConsumption,");
            strSql.Append("DriveKilometers=@DriveKilometers,");
            strSql.Append("IsCard=@IsCard,");
            strSql.Append("State=@State,");
            strSql.Append("Riviser=@Riviser,");
            strSql.Append("ReviseDate=@ReviseDate,");
            strSql.Append("Memo1=@Memo1,");
            strSql.Append("Memo2=@Memo2,");
            strSql.Append("Memo3=@Memo3,");
            strSql.Append("Memo4=@Memo4,");
            strSql.Append("Memo5=@Memo5,");
            strSql.Append("Memo6=@Memo6,");
            strSql.Append("Memo7=@Memo7,");
            strSql.Append("Memo8=@Memo8");
            strSql.Append(" where MemberID=@MemberID ");
            SqlParameter[] parameters = {
					new SqlParameter("@WebUserName", SqlDbType.NVarChar,50),
					new SqlParameter("@WebPwd", SqlDbType.NVarChar,50),
					new SqlParameter("@Name", SqlDbType.NVarChar,50),
					new SqlParameter("@Sex", SqlDbType.Int,4),
					new SqlParameter("@Birthday", SqlDbType.DateTime),
					new SqlParameter("@MobileTel", SqlDbType.NVarChar,50),
					new SqlParameter("@QQ", SqlDbType.NVarChar,50),
					new SqlParameter("@Email", SqlDbType.NVarChar,50),
					new SqlParameter("@IdentityCard", SqlDbType.NVarChar,50),
					new SqlParameter("@Address", SqlDbType.NVarChar,100),
					new SqlParameter("@ReturnVisitDate", SqlDbType.DateTime),
					new SqlParameter("@VehicleNo", SqlDbType.NVarChar,50),
					new SqlParameter("@VehicleStyle", SqlDbType.NVarChar,50),
					new SqlParameter("@EngineNo", SqlDbType.NVarChar,50),
					new SqlParameter("@VehicleFrameNo", SqlDbType.NVarChar,50),
					new SqlParameter("@DriveCardNo", SqlDbType.NVarChar,50),
					new SqlParameter("@DriveCardAnnualReviewDate", SqlDbType.DateTime),
					new SqlParameter("@DriveCardGetDate", SqlDbType.DateTime),
					new SqlParameter("@RideCardNo", SqlDbType.NVarChar,50),
					new SqlParameter("@RideCardAnnualReviewDate", SqlDbType.DateTime),
					new SqlParameter("@PurchaseDate", SqlDbType.DateTime),
					new SqlParameter("@NextMaintenanceDate", SqlDbType.DateTime),
					new SqlParameter("@VehicleAnnualInspectionDate", SqlDbType.DateTime),
					new SqlParameter("@InsuranceNo", SqlDbType.NVarChar,50),
					new SqlParameter("@InsuranceExpirationDate", SqlDbType.DateTime),
					new SqlParameter("@OilConsumption", SqlDbType.NVarChar,500),
					new SqlParameter("@DriveKilometers", SqlDbType.NVarChar,50),
					new SqlParameter("@IsCard", SqlDbType.Int,4),
					new SqlParameter("@State", SqlDbType.Int,4),
					new SqlParameter("@Riviser", SqlDbType.NVarChar,50),
					new SqlParameter("@ReviseDate", SqlDbType.DateTime),
					new SqlParameter("@Memo1", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo2", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo3", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo4", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo5", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo6", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo7", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo8", SqlDbType.NVarChar,100),
					new SqlParameter("@MemberID", SqlDbType.NVarChar,50)};
            parameters[0].Value = model.WebUserName;
            parameters[1].Value = model.WebPwd;
            parameters[2].Value = model.Name;
            parameters[3].Value = model.Sex;
            parameters[4].Value = model.Birthday;
            parameters[5].Value = model.MobileTel;
            parameters[6].Value = model.QQ;
            parameters[7].Value = model.Email;
            parameters[8].Value = model.IdentityCard;
            parameters[9].Value = model.Address;
            parameters[10].Value = model.ReturnVisitDate;
            parameters[11].Value = model.VehicleNo;
            parameters[12].Value = model.VehicleStyle;
            parameters[13].Value = model.EngineNo;
            parameters[14].Value = model.VehicleFrameNo;
            parameters[15].Value = model.DriveCardNo;
            parameters[16].Value = model.DriveCardAnnualReviewDate;
            parameters[17].Value = model.DriveCardGetDate;
            parameters[18].Value = model.RideCardNo;
            parameters[19].Value = model.RideCardAnnualReviewDate;
            parameters[20].Value = model.PurchaseDate;
            parameters[21].Value = model.NextMaintenanceDate;
            parameters[22].Value = model.VehicleAnnualInspectionDate;
            parameters[23].Value = model.InsuranceNo;
            parameters[24].Value = model.InsuranceExpirationDate;
            parameters[25].Value = model.OilConsumption;
            parameters[26].Value = model.DriveKilometers;
            parameters[27].Value = model.IsCard;
            parameters[28].Value = model.State;
            parameters[29].Value = model.Riviser;
            parameters[30].Value = model.ReviseDate;
            parameters[31].Value = model.Memo1;
            parameters[32].Value = model.Memo2;
            parameters[33].Value = model.Memo3;
            parameters[34].Value = model.Memo4;
            parameters[35].Value = model.Memo5;
            parameters[36].Value = model.Memo6;
            parameters[37].Value = model.Memo7;
            parameters[38].Value = model.Memo8;
            parameters[39].Value = model.MemberID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string MemberID)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from T_CF_OA_Member ");
            strSql.Append(" where MemberID=@MemberID ");
            SqlParameter[] parameters = {
					new SqlParameter("@MemberID", SqlDbType.NVarChar,50)			};
            parameters[0].Value = MemberID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string MemberIDlist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from T_CF_OA_Member ");
            strSql.Append(" where MemberID in (" + MemberIDlist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WISD.CarFriend.Model.CFModel.T_CF_OA_Member GetModel(string MemberID)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 MemberID,WebUserName,WebPwd,Name,Sex,Birthday,MobileTel,QQ,Email,IdentityCard,Address,ReturnVisitDate,VehicleNo,VehicleStyle,EngineNo,VehicleFrameNo,DriveCardNo,DriveCardAnnualReviewDate,DriveCardGetDate,RideCardNo,RideCardAnnualReviewDate,PurchaseDate,NextMaintenanceDate,VehicleAnnualInspectionDate,InsuranceNo,InsuranceExpirationDate,OilConsumption,DriveKilometers,IsCard,State,Riviser,ReviseDate,Memo1,Memo2,Memo3,Memo4,Memo5,Memo6,Memo7,Memo8 from T_CF_OA_Member ");
            strSql.Append(" where MemberID=@MemberID ");
            SqlParameter[] parameters = {
					new SqlParameter("@MemberID", SqlDbType.NVarChar,50)			};
            parameters[0].Value = MemberID;

            WISD.CarFriend.Model.CFModel.T_CF_OA_Member model = new WISD.CarFriend.Model.CFModel.T_CF_OA_Member();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["MemberID"] != null && ds.Tables[0].Rows[0]["MemberID"].ToString() != "")
                {
                    model.MemberID = ds.Tables[0].Rows[0]["MemberID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["WebUserName"] != null && ds.Tables[0].Rows[0]["WebUserName"].ToString() != "")
                {
                    model.WebUserName = ds.Tables[0].Rows[0]["WebUserName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["WebPwd"] != null && ds.Tables[0].Rows[0]["WebPwd"].ToString() != "")
                {
                    model.WebPwd = ds.Tables[0].Rows[0]["WebPwd"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Name"] != null && ds.Tables[0].Rows[0]["Name"].ToString() != "")
                {
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Sex"] != null && ds.Tables[0].Rows[0]["Sex"].ToString() != "")
                {
                    model.Sex = int.Parse(ds.Tables[0].Rows[0]["Sex"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Birthday"] != null && ds.Tables[0].Rows[0]["Birthday"].ToString() != "")
                {
                    model.Birthday = DateTime.Parse(ds.Tables[0].Rows[0]["Birthday"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MobileTel"] != null && ds.Tables[0].Rows[0]["MobileTel"].ToString() != "")
                {
                    model.MobileTel = ds.Tables[0].Rows[0]["MobileTel"].ToString();
                }
                if (ds.Tables[0].Rows[0]["QQ"] != null && ds.Tables[0].Rows[0]["QQ"].ToString() != "")
                {
                    model.QQ = ds.Tables[0].Rows[0]["QQ"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Email"] != null && ds.Tables[0].Rows[0]["Email"].ToString() != "")
                {
                    model.Email = ds.Tables[0].Rows[0]["Email"].ToString();
                }
                if (ds.Tables[0].Rows[0]["IdentityCard"] != null && ds.Tables[0].Rows[0]["IdentityCard"].ToString() != "")
                {
                    model.IdentityCard = ds.Tables[0].Rows[0]["IdentityCard"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Address"] != null && ds.Tables[0].Rows[0]["Address"].ToString() != "")
                {
                    model.Address = ds.Tables[0].Rows[0]["Address"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ReturnVisitDate"] != null && ds.Tables[0].Rows[0]["ReturnVisitDate"].ToString() != "")
                {
                    model.ReturnVisitDate = DateTime.Parse(ds.Tables[0].Rows[0]["ReturnVisitDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["VehicleNo"] != null && ds.Tables[0].Rows[0]["VehicleNo"].ToString() != "")
                {
                    model.VehicleNo = ds.Tables[0].Rows[0]["VehicleNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["VehicleStyle"] != null && ds.Tables[0].Rows[0]["VehicleStyle"].ToString() != "")
                {
                    model.VehicleStyle = ds.Tables[0].Rows[0]["VehicleStyle"].ToString();
                }
                if (ds.Tables[0].Rows[0]["EngineNo"] != null && ds.Tables[0].Rows[0]["EngineNo"].ToString() != "")
                {
                    model.EngineNo = ds.Tables[0].Rows[0]["EngineNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["VehicleFrameNo"] != null && ds.Tables[0].Rows[0]["VehicleFrameNo"].ToString() != "")
                {
                    model.VehicleFrameNo = ds.Tables[0].Rows[0]["VehicleFrameNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["DriveCardNo"] != null && ds.Tables[0].Rows[0]["DriveCardNo"].ToString() != "")
                {
                    model.DriveCardNo = ds.Tables[0].Rows[0]["DriveCardNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["DriveCardAnnualReviewDate"] != null && ds.Tables[0].Rows[0]["DriveCardAnnualReviewDate"].ToString() != "")
                {
                    model.DriveCardAnnualReviewDate = DateTime.Parse(ds.Tables[0].Rows[0]["DriveCardAnnualReviewDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DriveCardGetDate"] != null && ds.Tables[0].Rows[0]["DriveCardGetDate"].ToString() != "")
                {
                    model.DriveCardGetDate = DateTime.Parse(ds.Tables[0].Rows[0]["DriveCardGetDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RideCardNo"] != null && ds.Tables[0].Rows[0]["RideCardNo"].ToString() != "")
                {
                    model.RideCardNo = ds.Tables[0].Rows[0]["RideCardNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["RideCardAnnualReviewDate"] != null && ds.Tables[0].Rows[0]["RideCardAnnualReviewDate"].ToString() != "")
                {
                    model.RideCardAnnualReviewDate = DateTime.Parse(ds.Tables[0].Rows[0]["RideCardAnnualReviewDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PurchaseDate"] != null && ds.Tables[0].Rows[0]["PurchaseDate"].ToString() != "")
                {
                    model.PurchaseDate = DateTime.Parse(ds.Tables[0].Rows[0]["PurchaseDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NextMaintenanceDate"] != null && ds.Tables[0].Rows[0]["NextMaintenanceDate"].ToString() != "")
                {
                    model.NextMaintenanceDate = DateTime.Parse(ds.Tables[0].Rows[0]["NextMaintenanceDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["VehicleAnnualInspectionDate"] != null && ds.Tables[0].Rows[0]["VehicleAnnualInspectionDate"].ToString() != "")
                {
                    model.VehicleAnnualInspectionDate = DateTime.Parse(ds.Tables[0].Rows[0]["VehicleAnnualInspectionDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["InsuranceNo"] != null && ds.Tables[0].Rows[0]["InsuranceNo"].ToString() != "")
                {
                    model.InsuranceNo = ds.Tables[0].Rows[0]["InsuranceNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InsuranceExpirationDate"] != null && ds.Tables[0].Rows[0]["InsuranceExpirationDate"].ToString() != "")
                {
                    model.InsuranceExpirationDate = DateTime.Parse(ds.Tables[0].Rows[0]["InsuranceExpirationDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OilConsumption"] != null && ds.Tables[0].Rows[0]["OilConsumption"].ToString() != "")
                {
                    model.OilConsumption = ds.Tables[0].Rows[0]["OilConsumption"].ToString();
                }
                if (ds.Tables[0].Rows[0]["DriveKilometers"] != null && ds.Tables[0].Rows[0]["DriveKilometers"].ToString() != "")
                {
                    model.DriveKilometers = ds.Tables[0].Rows[0]["DriveKilometers"].ToString();
                }
                if (ds.Tables[0].Rows[0]["IsCard"] != null && ds.Tables[0].Rows[0]["IsCard"].ToString() != "")
                {
                    model.IsCard = int.Parse(ds.Tables[0].Rows[0]["IsCard"].ToString());
                }
                if (ds.Tables[0].Rows[0]["State"] != null && ds.Tables[0].Rows[0]["State"].ToString() != "")
                {
                    model.State = int.Parse(ds.Tables[0].Rows[0]["State"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Riviser"] != null && ds.Tables[0].Rows[0]["Riviser"].ToString() != "")
                {
                    model.Riviser = ds.Tables[0].Rows[0]["Riviser"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ReviseDate"] != null && ds.Tables[0].Rows[0]["ReviseDate"].ToString() != "")
                {
                    model.ReviseDate = DateTime.Parse(ds.Tables[0].Rows[0]["ReviseDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Memo1"] != null && ds.Tables[0].Rows[0]["Memo1"].ToString() != "")
                {
                    model.Memo1 = ds.Tables[0].Rows[0]["Memo1"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Memo2"] != null && ds.Tables[0].Rows[0]["Memo2"].ToString() != "")
                {
                    model.Memo2 = ds.Tables[0].Rows[0]["Memo2"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Memo3"] != null && ds.Tables[0].Rows[0]["Memo3"].ToString() != "")
                {
                    model.Memo3 = ds.Tables[0].Rows[0]["Memo3"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Memo4"] != null && ds.Tables[0].Rows[0]["Memo4"].ToString() != "")
                {
                    model.Memo4 = ds.Tables[0].Rows[0]["Memo4"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Memo5"] != null && ds.Tables[0].Rows[0]["Memo5"].ToString() != "")
                {
                    model.Memo5 = ds.Tables[0].Rows[0]["Memo5"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Memo6"] != null && ds.Tables[0].Rows[0]["Memo6"].ToString() != "")
                {
                    model.Memo6 = ds.Tables[0].Rows[0]["Memo6"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Memo7"] != null && ds.Tables[0].Rows[0]["Memo7"].ToString() != "")
                {
                    model.Memo7 = ds.Tables[0].Rows[0]["Memo7"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Memo8"] != null && ds.Tables[0].Rows[0]["Memo8"].ToString() != "")
                {
                    model.Memo8 = ds.Tables[0].Rows[0]["Memo8"].ToString();
                }
                return model;
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select MemberID,WebUserName,WebPwd,Name,Sex,Birthday,MobileTel,QQ,Email,IdentityCard,Address,ReturnVisitDate,VehicleNo,VehicleStyle,EngineNo,VehicleFrameNo,DriveCardNo,DriveCardAnnualReviewDate,DriveCardGetDate,RideCardNo,RideCardAnnualReviewDate,PurchaseDate,NextMaintenanceDate,VehicleAnnualInspectionDate,InsuranceNo,InsuranceExpirationDate,OilConsumption,DriveKilometers,IsCard,State,Riviser,ReviseDate,Memo1,Memo2,Memo3,Memo4,Memo5,Memo6,Memo7,Memo8 ");
            strSql.Append(" FROM T_CF_OA_Member ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" MemberID,WebUserName,WebPwd,Name,Sex,Birthday,MobileTel,QQ,Email,IdentityCard,Address,ReturnVisitDate,VehicleNo,VehicleStyle,EngineNo,VehicleFrameNo,DriveCardNo,DriveCardAnnualReviewDate,DriveCardGetDate,RideCardNo,RideCardAnnualReviewDate,PurchaseDate,NextMaintenanceDate,VehicleAnnualInspectionDate,InsuranceNo,InsuranceExpirationDate,OilConsumption,DriveKilometers,IsCard,State,Riviser,ReviseDate,Memo1,Memo2,Memo3,Memo4,Memo5,Memo6,Memo7,Memo8 ");
            strSql.Append(" FROM T_CF_OA_Member ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) FROM T_CF_OA_Member ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.MemberID desc");
            }
            strSql.Append(")AS Row, T.*  from T_CF_OA_Member T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return DbHelperSQL.Query(strSql.ToString());
        }
        #endregion


        #region SelfCode
        /// <summary>
        ///  初始化页面和查询数据
        /// </summary>
        /// <param name="pageSize">每页显示的条数</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="condition">搜索条件</param>
        /// <returns></returns>
        public static string GetData(int pageSize, int pageIndex, string condition)
        {
            StringBuilder tableName = new StringBuilder(); //从哪些表里面进行查询
            tableName.Append(" T_CF_OA_Member a ");
            string order = " a.MemberID desc ";  //排序的字段
            StringBuilder fields = new StringBuilder(); //返回的列
            fields.Append(" a.MemberID main,a.MemberID,a.Name,case a.Sex when 0 then '女' when 1  then '男' else '' end Sex,a.MobileTel,a.VehicleNo,a.VehicleStyle")
                        .Append(",case a.IsCard when 0 then '未开卡' when 1  then '已开卡' else '' end IsCard");
            StringBuilder where = new StringBuilder(); //查询的条件
            where.Append(" 1=1 ");
            if (condition != "")
            {
                string[] array = condition.Split('@');
                string MemberID = array[0];
                string Name = array[1];
                string MobileTel = array[2];
                string VehicleNo = array[3];
                string IsCard = array[4];

                if (MemberID.Trim() != "null")
                {
                    where.AppendFormat("  and a.MemberID=\'{0}\'  ", MemberID);
                }
                if (Name.Trim() != "null")
                {
                    where.AppendFormat("  and a.Name like N\'%{0}%\' ", Name);
                }
                if (MobileTel.Trim() != "null")
                {
                    where.AppendFormat("  and a.MobileTel=\'{0}\'  ", MobileTel);
                }
                if (VehicleNo.Trim() != "null")
                {
                    where.AppendFormat("  and a.VehicleNo=\'{0}\'  ", VehicleNo);
                }
                if (IsCard.Trim() != "null")
                {
                    where.AppendFormat("  and a.IsCard={0}  ", IsCard);
                }
            }
            object[] objectArray = new object[] { tableName.ToString(), fields.ToString(), order, pageSize, pageIndex, where };
            DataTable dt = new DataTable();
            int recordCount = 0;
            dt = dalSqlHelper.ExecuteProcedure(objectArray, ref recordCount);
            if (dt.Rows.Count > 0)
            {
                return dalSqlHelper.DtToSON(dt) + "@" + recordCount.ToString();
            }
            else
            {
                return "@0";
            }
        }


        /// <summary>
        /// 查询指定主键对应的记录
        /// </summary>
        /// <param name="pk"></param>
        /// <returns></returns>
        public static string GetOne(string pk)
        {
            StringBuilder tableName = new StringBuilder(); //从哪些表里面进行查询
            tableName.Append(" T_CF_OA_Member a ");
            string order = " a.MemberID desc ";  //排序的字段
            StringBuilder fields = new StringBuilder(); //返回的列
            fields.Append(" a.MemberID,a.WebUserName,a.WebPwd,a.Name,a.Sex,a.Birthday,a.MobileTel,a.QQ,a.Email,")
                .Append("a.IdentityCard,a.Address,a.ReturnVisitDate,a.VehicleNo,a.VehicleStyle,a.EngineNo,a.VehicleFrameNo,")
                .Append("a.DriveCardNo,a.DriveCardAnnualReviewDate,a.DriveCardGetDate,a.RideCardNo,a.RideCardAnnualReviewDate,")
                .Append("a.PurchaseDate,a.NextMaintenanceDate,a.VehicleAnnualInspectionDate,a.InsuranceNo,a.InsuranceExpirationDate,")
                .Append("a.OilConsumption,a.DriveKilometers,a.IsCard,a.State,a.Riviser,a.ReviseDate,a.Memo1,a.Memo2,a.Memo3,a.Memo4,")
                .Append("a.Memo5,a.Memo6,a.Memo7,a.Memo8 ");
            StringBuilder where = new StringBuilder(); //查询的条件
            where.AppendFormat(" a.MemberID=N\'{0}\' ", pk);
            object[] objectArray = new object[] { tableName.ToString(), fields.ToString(), order, 1, 1, where };
            DataTable dt = new DataTable();
            int recordCount = 0;
            dt = dalSqlHelper.ExecuteProcedure(objectArray, ref recordCount);
            if (dt.Rows.Count > 0)
            {
                return dalSqlHelper.DtToSON(dt);
            }
            else
            {
                return "";
            }
        }


        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="dictionary"></param>
        /// <returns></returns>
        public static string AddEntity(IDictionary<string, string> dictionary)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("insert into T_CF_OA_Member(");
            sql.Append("MemberID,WebUserName,WebPwd,Name,Sex,Birthday,MobileTel,QQ,Email,IdentityCard,Address,ReturnVisitDate,VehicleNo,VehicleStyle,EngineNo,VehicleFrameNo,DriveCardNo,DriveCardAnnualReviewDate,DriveCardGetDate,RideCardNo,RideCardAnnualReviewDate,PurchaseDate,NextMaintenanceDate,VehicleAnnualInspectionDate,InsuranceNo,InsuranceExpirationDate,OilConsumption,DriveKilometers,IsCard,State,Riviser,ReviseDate,Memo1,Memo2,Memo3,Memo4,Memo5,Memo6,Memo7,Memo8)");
            sql.Append(" values (");
            sql.Append("@MemberID,@WebUserName,@WebPwd,@Name,@Sex,@Birthday,@MobileTel,@QQ,@Email,@IdentityCard,@Address,@ReturnVisitDate,@VehicleNo,@VehicleStyle,@EngineNo,@VehicleFrameNo,@DriveCardNo,@DriveCardAnnualReviewDate,@DriveCardGetDate,@RideCardNo,@RideCardAnnualReviewDate,@PurchaseDate,@NextMaintenanceDate,@VehicleAnnualInspectionDate,@InsuranceNo,@InsuranceExpirationDate,@OilConsumption,@DriveKilometers,@IsCard,@State,@Riviser,@ReviseDate,@Memo1,@Memo2,@Memo3,@Memo4,@Memo5,@Memo6,@Memo7,@Memo8)");
            SqlParameter[] parameters = {
					new SqlParameter("@MemberID", SqlDbType.NVarChar,50),
					new SqlParameter("@WebUserName", SqlDbType.NVarChar,50),
					new SqlParameter("@WebPwd", SqlDbType.NVarChar,50),
					new SqlParameter("@Name", SqlDbType.NVarChar,50),
					new SqlParameter("@Sex", SqlDbType.Int,4),
					new SqlParameter("@Birthday", SqlDbType.DateTime),
					new SqlParameter("@MobileTel", SqlDbType.NVarChar,50),
					new SqlParameter("@QQ", SqlDbType.NVarChar,50),
					new SqlParameter("@Email", SqlDbType.NVarChar,50),
					new SqlParameter("@IdentityCard", SqlDbType.NVarChar,50),
					new SqlParameter("@Address", SqlDbType.NVarChar,100),
					new SqlParameter("@ReturnVisitDate", SqlDbType.DateTime),
					new SqlParameter("@VehicleNo", SqlDbType.NVarChar,50),
					new SqlParameter("@VehicleStyle", SqlDbType.NVarChar,50),
					new SqlParameter("@EngineNo", SqlDbType.NVarChar,50),
					new SqlParameter("@VehicleFrameNo", SqlDbType.NVarChar,50),
					new SqlParameter("@DriveCardNo", SqlDbType.NVarChar,50),
					new SqlParameter("@DriveCardAnnualReviewDate", SqlDbType.DateTime),
					new SqlParameter("@DriveCardGetDate", SqlDbType.DateTime),
					new SqlParameter("@RideCardNo", SqlDbType.NVarChar,50),
					new SqlParameter("@RideCardAnnualReviewDate", SqlDbType.DateTime),
					new SqlParameter("@PurchaseDate", SqlDbType.DateTime),
					new SqlParameter("@NextMaintenanceDate", SqlDbType.DateTime),
					new SqlParameter("@VehicleAnnualInspectionDate", SqlDbType.DateTime),
					new SqlParameter("@InsuranceNo", SqlDbType.NVarChar,50),
					new SqlParameter("@InsuranceExpirationDate", SqlDbType.DateTime),
					new SqlParameter("@OilConsumption", SqlDbType.NVarChar,500),
					new SqlParameter("@DriveKilometers", SqlDbType.NVarChar,50),
					new SqlParameter("@IsCard", SqlDbType.Int,4),
					new SqlParameter("@State", SqlDbType.Int,4),
					new SqlParameter("@Riviser", SqlDbType.NVarChar,50),
					new SqlParameter("@ReviseDate", SqlDbType.DateTime),
					new SqlParameter("@Memo1", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo2", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo3", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo4", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo5", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo6", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo7", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo8", SqlDbType.NVarChar,100)};
            parameters[0].Value = StringHandle.GetDictionaryValue<string>(dictionary, "MemberID");
            parameters[1].Value = StringHandle.GetDictionaryValue<string>(dictionary, "WebUserName");
            parameters[2].Value = StringHandle.GetDictionaryValue<string>(dictionary, "WebPwd");
            parameters[3].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Name");
            parameters[4].Value = StringHandle.GetDictionaryValue<int>(dictionary, "Sex");
            parameters[5].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "Birthday");
            parameters[6].Value = StringHandle.GetDictionaryValue<string>(dictionary, "MobileTel");
            parameters[7].Value = StringHandle.GetDictionaryValue<string>(dictionary, "QQ");
            parameters[8].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Email");
            parameters[9].Value = StringHandle.GetDictionaryValue<string>(dictionary, "IdentityCard");
            parameters[10].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Address");
            parameters[11].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "ReturnVisitDate");
            parameters[12].Value = StringHandle.GetDictionaryValue<string>(dictionary, "VehicleNo");
            parameters[13].Value = StringHandle.GetDictionaryValue<string>(dictionary, "VehicleStyle");
            parameters[14].Value = StringHandle.GetDictionaryValue<string>(dictionary, "EngineNo");
            parameters[15].Value = StringHandle.GetDictionaryValue<string>(dictionary, "VehicleFrameNo");
            parameters[16].Value = StringHandle.GetDictionaryValue<string>(dictionary, "DriveCardNo");
            parameters[17].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "DriveCardAnnualReviewDate");
            parameters[18].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "DriveCardGetDate");
            parameters[19].Value = StringHandle.GetDictionaryValue<string>(dictionary, "RideCardNo");
            parameters[20].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "RideCardAnnualReviewDate");
            parameters[21].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "PurchaseDate");
            parameters[22].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "NextMaintenanceDate");
            parameters[23].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "VehicleAnnualInspectionDate");
            parameters[24].Value = StringHandle.GetDictionaryValue<string>(dictionary, "InsuranceNo");
            parameters[25].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "InsuranceExpirationDate");
            parameters[26].Value = StringHandle.GetDictionaryValue<string>(dictionary, "OilConsumption");
            parameters[27].Value = StringHandle.GetDictionaryValue<string>(dictionary, "DriveKilometers");
            parameters[28].Value = StringHandle.GetDictionaryValue<int>(dictionary, "IsCard");
            parameters[29].Value = StringHandle.GetDictionaryValue<int>(dictionary, "State");
            parameters[30].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Reviser");
            parameters[31].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "ReviseDate");
            parameters[32].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo1");
            parameters[33].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo2");
            parameters[34].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo3");
            parameters[35].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo4");
            parameters[36].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo5");
            parameters[37].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo6");
            parameters[38].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo7");
            parameters[39].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo8");

            SqlObject sqlObject = new SqlObject();
            sqlObject.Sql = sql.ToString();
            sqlObject.PramS = parameters;
            List<SqlObject> sqlObjectList = new List<SqlObject>();
            sqlObjectList.Add(sqlObject);

            if (dalSqlHelper.ExecuteTransaction(sqlObjectList))
            {
                return "Success";
            }
            else
            {
                return "Failure";
            }
        }


        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="pk"></param>
        /// <returns></returns>
        public static string DeleteEntity(string pk)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("delete from T_CF_OA_Member ");
            sql.Append(" where MemberID=@MemberID ");
            SqlParameter[] parameters = {
					new SqlParameter("@MemberID", SqlDbType.NVarChar,50)};
            parameters[0].Value = pk;

            SqlObject sqlObject = new SqlObject();
            sqlObject.Sql = sql.ToString();
            sqlObject.PramS = parameters;
            List<SqlObject> sqlObjectList = new List<SqlObject>();
            sqlObjectList.Add(sqlObject);

            if (dalSqlHelper.ExecuteTransaction(sqlObjectList))
            {
                return "Success";
            }
            else
            {
                return "Failure";
            }
        }


        /// <summary>
        /// 修改记录
        /// </summary>
        /// <param name="dictionary"></param>
        /// <returns></returns>
        public static string EditEntity(IDictionary<string, string> dictionary)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("update T_CF_OA_Member set ");
            sql.Append("WebUserName=@WebUserName,");
            sql.Append("WebPwd=@WebPwd,");
            sql.Append("Name=@Name,");
            sql.Append("Sex=@Sex,");
            sql.Append("Birthday=@Birthday,");
            sql.Append("MobileTel=@MobileTel,");
            sql.Append("QQ=@QQ,");
            sql.Append("Email=@Email,");
            sql.Append("IdentityCard=@IdentityCard,");
            sql.Append("Address=@Address,");
            sql.Append("ReturnVisitDate=@ReturnVisitDate,");
            sql.Append("VehicleNo=@VehicleNo,");
            sql.Append("VehicleStyle=@VehicleStyle,");
            sql.Append("EngineNo=@EngineNo,");
            sql.Append("VehicleFrameNo=@VehicleFrameNo,");
            sql.Append("DriveCardNo=@DriveCardNo,");
            sql.Append("DriveCardAnnualReviewDate=@DriveCardAnnualReviewDate,");
            sql.Append("DriveCardGetDate=@DriveCardGetDate,");
            sql.Append("RideCardNo=@RideCardNo,");
            sql.Append("RideCardAnnualReviewDate=@RideCardAnnualReviewDate,");
            sql.Append("PurchaseDate=@PurchaseDate,");
            sql.Append("NextMaintenanceDate=@NextMaintenanceDate,");
            sql.Append("VehicleAnnualInspectionDate=@VehicleAnnualInspectionDate,");
            sql.Append("InsuranceNo=@InsuranceNo,");
            sql.Append("InsuranceExpirationDate=@InsuranceExpirationDate,");
            sql.Append("OilConsumption=@OilConsumption,");
            sql.Append("DriveKilometers=@DriveKilometers,");
            sql.Append("IsCard=@IsCard,");
            sql.Append("State=@State,");
            sql.Append("Riviser=@Riviser,");
            sql.Append("ReviseDate=@ReviseDate,");
            sql.Append("Memo1=@Memo1,");
            sql.Append("Memo2=@Memo2,");
            sql.Append("Memo3=@Memo3,");
            sql.Append("Memo4=@Memo4,");
            sql.Append("Memo5=@Memo5,");
            sql.Append("Memo6=@Memo6,");
            sql.Append("Memo7=@Memo7,");
            sql.Append("Memo8=@Memo8");
            sql.Append(" where MemberID=@MemberID ");
            SqlParameter[] parameters = {
					new SqlParameter("@WebUserName", SqlDbType.NVarChar,50),
					new SqlParameter("@WebPwd", SqlDbType.NVarChar,50),
					new SqlParameter("@Name", SqlDbType.NVarChar,50),
					new SqlParameter("@Sex", SqlDbType.Int,4),
					new SqlParameter("@Birthday", SqlDbType.DateTime),
					new SqlParameter("@MobileTel", SqlDbType.NVarChar,50),
					new SqlParameter("@QQ", SqlDbType.NVarChar,50),
					new SqlParameter("@Email", SqlDbType.NVarChar,50),
					new SqlParameter("@IdentityCard", SqlDbType.NVarChar,50),
					new SqlParameter("@Address", SqlDbType.NVarChar,100),
					new SqlParameter("@ReturnVisitDate", SqlDbType.DateTime),
					new SqlParameter("@VehicleNo", SqlDbType.NVarChar,50),
					new SqlParameter("@VehicleStyle", SqlDbType.NVarChar,50),
					new SqlParameter("@EngineNo", SqlDbType.NVarChar,50),
					new SqlParameter("@VehicleFrameNo", SqlDbType.NVarChar,50),
					new SqlParameter("@DriveCardNo", SqlDbType.NVarChar,50),
					new SqlParameter("@DriveCardAnnualReviewDate", SqlDbType.DateTime),
					new SqlParameter("@DriveCardGetDate", SqlDbType.DateTime),
					new SqlParameter("@RideCardNo", SqlDbType.NVarChar,50),
					new SqlParameter("@RideCardAnnualReviewDate", SqlDbType.DateTime),
					new SqlParameter("@PurchaseDate", SqlDbType.DateTime),
					new SqlParameter("@NextMaintenanceDate", SqlDbType.DateTime),
					new SqlParameter("@VehicleAnnualInspectionDate", SqlDbType.DateTime),
					new SqlParameter("@InsuranceNo", SqlDbType.NVarChar,50),
					new SqlParameter("@InsuranceExpirationDate", SqlDbType.DateTime),
					new SqlParameter("@OilConsumption", SqlDbType.NVarChar,500),
					new SqlParameter("@DriveKilometers", SqlDbType.NVarChar,50),
					new SqlParameter("@IsCard", SqlDbType.Int,4),
					new SqlParameter("@State", SqlDbType.Int,4),
					new SqlParameter("@Riviser", SqlDbType.NVarChar,50),
					new SqlParameter("@ReviseDate", SqlDbType.DateTime),
					new SqlParameter("@Memo1", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo2", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo3", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo4", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo5", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo6", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo7", SqlDbType.NVarChar,100),
					new SqlParameter("@Memo8", SqlDbType.NVarChar,100),
					new SqlParameter("@MemberID", SqlDbType.NVarChar,50)};
            parameters[0].Value = StringHandle.GetDictionaryValue<string>(dictionary, "WebUserName");
            parameters[1].Value = StringHandle.GetDictionaryValue<string>(dictionary, "WebPwd");
            parameters[2].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Name");
            parameters[3].Value = StringHandle.GetDictionaryValue<int>(dictionary, "Sex");
            parameters[4].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "Birthday");
            parameters[5].Value = StringHandle.GetDictionaryValue<string>(dictionary, "MobileTel");
            parameters[6].Value = StringHandle.GetDictionaryValue<string>(dictionary, "QQ");
            parameters[7].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Email");
            parameters[8].Value = StringHandle.GetDictionaryValue<string>(dictionary, "IdentityCard");
            parameters[9].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Address");
            parameters[10].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "ReturnVisitDate");
            parameters[11].Value = StringHandle.GetDictionaryValue<string>(dictionary, "VehicleNo");
            parameters[12].Value = StringHandle.GetDictionaryValue<string>(dictionary, "VehicleStyle");
            parameters[13].Value = StringHandle.GetDictionaryValue<string>(dictionary, "EngineNo");
            parameters[14].Value = StringHandle.GetDictionaryValue<string>(dictionary, "VehicleFrameNo");
            parameters[15].Value = StringHandle.GetDictionaryValue<string>(dictionary, "DriveCardNo");
            parameters[16].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "DriveCardAnnualReviewDate");
            parameters[17].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "DriveCardGetDate");
            parameters[18].Value = StringHandle.GetDictionaryValue<string>(dictionary, "RideCardNo");
            parameters[19].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "RideCardAnnualReviewDate");
            parameters[20].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "PurchaseDate");
            parameters[21].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "NextMaintenanceDate");
            parameters[22].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "VehicleAnnualInspectionDate");
            parameters[23].Value = StringHandle.GetDictionaryValue<string>(dictionary, "InsuranceNo");
            parameters[24].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "InsuranceExpirationDate");
            parameters[25].Value = StringHandle.GetDictionaryValue<string>(dictionary, "OilConsumption");
            parameters[26].Value = StringHandle.GetDictionaryValue<string>(dictionary, "DriveKilometers");
            parameters[27].Value = StringHandle.GetDictionaryValue<int>(dictionary, "IsCard");
            parameters[28].Value = StringHandle.GetDictionaryValue<int>(dictionary, "State");
            parameters[29].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Reviser");
            parameters[30].Value = StringHandle.GetDictionaryValue<DateTime>(dictionary, "ReviseDate");
            parameters[31].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo1");
            parameters[32].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo2");
            parameters[33].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo3");
            parameters[34].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo4");
            parameters[35].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo5");
            parameters[36].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo6");
            parameters[37].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo7");
            parameters[38].Value = StringHandle.GetDictionaryValue<string>(dictionary, "Memo8");
            parameters[39].Value = StringHandle.GetDictionaryValue<string>(dictionary, "MemberID");

            SqlObject sqlObject = new SqlObject();
            sqlObject.Sql = sql.ToString();
            sqlObject.PramS = parameters;
            List<SqlObject> sqlObjectList = new List<SqlObject>();
            sqlObjectList.Add(sqlObject);

            if (dalSqlHelper.ExecuteTransaction(sqlObjectList))
            {
                return "Success";
            }
            else
            {
                return "Failure";
            }
        }


        /// <summary>
        /// 获取会员编号
        /// </summary>
        /// <returns></returns>
        public static string GetMemberId()
        {
            return DateTime.Now.ToString("yyyyMMddHHmmss");
        }


        /// <summary>
        /// 修改会员开卡状态
        /// （1：已开卡 0：未开卡）
        /// </summary>
        /// <param name="memberID"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public static bool UpdateCardState(string memberID, int state)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(" UPDATE    T_CF_OA_Member ");
            strSql.Append(" SET IsCard = @IsCard ");
            strSql.Append(" WHERE  (MemberID = @MemberID) ");
            SqlParameter[] parameters = {
                new SqlParameter("@IsCard", SqlDbType.Int,4),
                new SqlParameter("@MemberID", SqlDbType.NVarChar,50)};
            parameters[0].Value = state;
            parameters[1].Value = memberID.Trim();
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        #endregion

    }
}
